using System.ComponentModel.DataAnnotations;

namespace Net8.Identity.Server.Models
{
    /// <summary>
    /// CORS配置实体
    /// </summary>
    public class CorsSetting
    {
        /// <summary>
        /// 主键
        /// </summary>
        [Key]
        public int Id { get; set; }

        /// <summary>
        /// 策略名称
        /// </summary>
        [Required]
        public string PolicyName { get; set; } = "AllowSpecificOrigins";

        /// <summary>
        /// 允许的来源列表（逗号分隔）
        /// </summary>
        [Required]
        public string AllowedOrigins { get; set; } = "";

        /// <summary>
        /// 是否允许凭据
        /// </summary>
        public bool AllowCredentials { get; set; } = true;

        /// <summary>
        /// 是否允许任何头部
        /// </summary>
        public bool AllowAnyHeader { get; set; } = true;

        /// <summary>
        /// 是否允许任何方法
        /// </summary>
        public bool AllowAnyMethod { get; set; } = true;

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime CreatedAt { get; set; } = DateTime.UtcNow;

        /// <summary>
        /// 更新时间
        /// </summary>
        public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
    }
}